package com.rjj.wlqq.wx.controller;

import com.rjj.wlqq.wx.tool.wx.WeixinCheckoutUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author r
 * @date 2020/12/29 20:27
 */
@Controller
public class WxIndexController
{
    @RequestMapping("/wx/index")
    public String index()
    {
        return "/wx/wx";
    }

    @ResponseBody
    @RequestMapping("verify")
    public String verifyUrl(String signature, String timestamp, String nonce, String echostr)
    {
        final boolean b = WeixinCheckoutUtil.checkSignature(signature, timestamp, nonce);
        if (b)
        {
            return echostr;
        }
        return "0";
    }
}
